package com.xzy;

import com.spring.XiaozyApplicationContext;
import com.xzy.config.AppConfig;
import com.xzy.service.CatService;
import com.xzy.service.UserService;

/**
 * @author xzy
 * @date 2021/11/310:24
 */
public class Test {

    public static void main(String[] args) {

        XiaozyApplicationContext applicationContext = new XiaozyApplicationContext(AppConfig.class);

        System.out.println("--------------------获取原型Bean--------------------");
        UserService userService1 = (UserService) applicationContext.getBean("userService");
        UserService userService2 = (UserService) applicationContext.getBean("userService");
        UserService userService3 = (UserService) applicationContext.getBean("userService");
        System.out.println(userService1);
        System.out.println(userService2);
        System.out.println(userService3);

        System.out.println("--------------------获取单例Bean--------------------");
        CatService catService1 = (CatService) applicationContext.getBean("catService");
        CatService catService2 = (CatService) applicationContext.getBean("catService");
        CatService catService3 = (CatService) applicationContext.getBean("catService");
        System.out.println(catService1);
        System.out.println(catService2);
        System.out.println(catService3);

        System.out.println("--------------------依赖注入--------------------");
        catService1.info();
        catService2.info();
        catService3.info();

        System.out.println("--------------------AOP--------------------");
        userService1.sayHello();
    }
}
